__author__ = 'zoulida'

import time


def time_me(fn):
    import time
    def _wrapper(*args, **kwargs):
        starttime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
        start = time.process_time()
        print('Start ',fn.__name__)
        fn(*args, **kwargs)
        print("%s cost %s second" % (fn.__name__, time.process_time() - start))#如果是0，是因为不记录sleep时间，所以去找找有没有sleep（）。
        print('Start time is ', starttime)
        # print('Finish time is ', time.process_time())
        print('Finish time is ', time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))

    return _wrapper

@time_me
def testwrapper():
    time.sleep(2)
    print('time.sleep2')

if __name__ == '__main__':

    testwrapper()
